
    // include HashMap.js

    /*
     * This is how to emulate private properties- but as functions can
     * be deleted, modified and so on, its practically useless in production.
     * The technique is included here purely for informational purposes.
     */

    Class.implement
    (
        // create a closure object
        new function () 
        {
            /*
             * Create a static private hashmap- its keys will be instances
             * of Class, and its values will be plain objects. Instance 
             * properties are stored on these objects, and this is how
             * the visibility of the properties is kept hidden.
             */
            var map= new HashMap;
            
            this.constructor.implement
            (
                /**
                 * 
                 * @param {String} name
                 * @param {Object} value
                 * @return {void}
                 */
                function set (accessor, value) 
                {
                    // retrieve the object associated with this instance
                    var properties= map.get(this);
                    // then assign the property to it
                    properties[accessor]= value;
                }
                
                /**
                 * 
                 * @param {String} name
                 * @return {Object}
                 * @throws {ReferenceError}
                 */
            ,   function get (accessor) 
                {
                    // retrieve the object associated with this instance
                    var properties= map.get(this);
                    if (accessor in properties) // check if its defined
                        // return the value by its accessor
                        return properties[accessor];
                        
                    throw new ReferenceError ('UndefinedProperty: ' + accessor);
                }
                
                /**
                 * Dispose of a class instance. Its properties can no longer
                 * be set or get
                 * @return {void}
                 */
            ,   function dispose () 
                {
                    // dispose of this instance- required for garbage collection
                    map.remove(this);
                }
                
                /**
                 * 
                 */
            ,   function initialize () 
                {
                    if (map.has(this))
                        return;
                        
                    var properties= new Object;
                    // associate the properties object with this instance
                    map.put(this, properties);
                }
            );
        }
    );
    
    function Class () 
    {
        this.initialize();
    };
    
    
